package com.axt.dbaudit.action.query;

import java.util.List;
import org.apache.struts2.json.annotations.JSON;

import com.axt.dbaudit.bean.query.QueryRealAlarmBean;
import com.axt.dbaudit.bean.query.QuerySessionBean;
import com.axt.dbaudit.model.query.AlarmDetail;
import com.axt.dbaudit.model.query.RealAlarm;
import com.axt.dbaudit.model.query.Session;
import com.axt.dbaudit.model.query.SessionDetail;
import com.axt.dbaudit.model.query.SessionDetailHead;
import com.axt.soa.msg.types.*;

public class QueryRealAlarmAction extends QueryBaseAction {
	private QueryRealAlarmBean realAlarmBean = new QueryRealAlarmBean();
	private List<RealAlarm> realAlarms = null;
	private List<AlarmDetail> realAlarmDetails = null;

	@JSON(name = "realalarms")
	public List<RealAlarm> getAlarms() {
		return realAlarms;
	}

	void setRealAlarm(List<RealAlarm> realAlarms) {
		this.realAlarms = realAlarms;
	}

	@JSON(name = "realalarmdetails")
	public List<AlarmDetail> getRealAlarmDetails() {
		return realAlarmDetails;
	}

	public void setRealAlarmDetails(List<AlarmDetail> realAlarmDetails) {
		this.realAlarmDetails = realAlarmDetails;
	}

	@JSON(name = "totalRows")
	public int getTotalRows() {
		return totalRows;
	}

	@JSON(name = "queryProgress")
	public String getQueryProgress() {
		return queryProgress;
	}

	@JSON(name = "queryDate")
	public String getQueryDate() {
		return queryDate;
	}

	@JSON(name = "errcode")
	public int getErrcode() {
		return errcode;
	}

	@JSON(name = "errinfo")
	public String getErrinfo() {
		return errinfo;
	}

	/* 实时报警查询 */
	public String queryRealAlarms() {

		realAlarmBean.queryRealAlarms(serverPath, filters, maxRowNum);

		setErrcode(realAlarmBean.getErrcode());
		setErrinfo(realAlarmBean.getErrinfo());

		return MsgParam.SUCCESS;

	}

	public String queryRealAlarmDeatil() {
		/* 查询实时报警详细信息 */
		realAlarmBean.queryRealAlarmDetail(serverPath, filters);
		setRealAlarmDetails(realAlarmBean.getAlarmDetail());
		setErrcode(realAlarmBean.getErrcode());
		setErrinfo(realAlarmBean.getErrinfo());

		return MsgParam.SUCCESS;
	}
}
